package linuxbox.poll.logic;

import java.sql.Timestamp;
import linuxbox.BoxStatic;

public class BoxPollEntry
{
  protected	int m_iID = 0;
  protected	boolean m_bMultiple = false;
  protected	boolean m_bShowVoter = false;
  protected	boolean m_bShowResult = false;
  protected	boolean m_bManualConclude = false;
  protected	boolean m_bClosed = false;
  protected	int m_iSendResult = 0;
  protected int m_CreatedBy = -1;
  protected String m_sSubject = "";
  protected String m_sDescription = "";
  protected	Timestamp m_CreateTime;
  protected	Timestamp m_ConcludeTime;

  public void copyFrom(BoxPollEntry entry)
  {
    m_iID = entry.getID();
    m_bMultiple = entry.getMultiple();
    m_bShowVoter = entry.getShowVoter();
    m_bShowResult = entry.getShowResult();
    m_bManualConclude = entry.getManualConclude();
    m_bClosed = entry.getClosed();
    m_iSendResult = entry.getSendResult();
    m_CreatedBy = entry.getCreatedBy();

    if (entry.getSubject() == null)
      m_sSubject = "";
    else
      m_sSubject = new String(entry.getSubject());

    if (entry.getDescription() == null)
      m_sDescription = "";
    else
      m_sDescription = new String(entry.getDescription());

    if (entry.getCreateTime() == null)
      m_CreateTime = null;
    else
      m_CreateTime = new Timestamp(entry.getCreateTime().getTime());

    if ( entry.getConcludeTime() == null )
      m_ConcludeTime = null;
    else
      m_ConcludeTime = new Timestamp(entry.getConcludeTime().getTime());
  }
  public int getID()
  {
    return m_iID;
  }
  public void setID(int id)
  {
    m_iID = id;
  }

  public String getSubject()
  {
    return m_sSubject;
  }
  public void setSubject(String s)
  {
    m_sSubject = s;
  }

  public String getDescription()
  {
    return m_sDescription;
  }
  public void setDescription(String s)
  {
    m_sDescription = s;
  }

  public int getCreatedBy()
  {
    return m_CreatedBy;
  }
  public void setCreatedBy(int s)
  {
    m_CreatedBy = s;
  }

  public boolean getMultiple()
  {
    return m_bMultiple;
  }
  public void setMultiple(boolean p)
  {
    m_bMultiple = p;
  }

  public boolean getShowVoter()
  {
    return m_bShowVoter;
  }
  public void setShowVoter(boolean b)
  {
    m_bShowVoter= b;
  }

  public boolean getShowResult()
  {
    return m_bShowResult;
  }
  public void setShowResult(boolean b)
  {
    m_bShowResult = b;
  }

  public boolean getManualConclude()
  {
    return m_bManualConclude;
  }
  public void setManualConclude(boolean b)
  {
    m_bManualConclude = b;
  }

  public boolean getClosed()
  {
    return m_bClosed;
  }
  public void setClosed(boolean b)
  {
    m_bClosed = b;
  }

  public int getSendResult()
  {
    return m_iSendResult;
  }
  public void setSendResult(int b)
  {
    m_iSendResult = b;
  }

  public Timestamp getCreateTime()
  {
    return m_CreateTime;
  }
  public void setCreateTime(Timestamp tm)
  {
    m_CreateTime = tm;
  }
  public String getCreateTimeString()
  {
    if ( m_CreateTime == null)
      return "";
    else
    {
      BoxStatic.dateTimeFormatter.applyPattern(BoxStatic.SHORT_DATE_FORMAT);
      return BoxStatic.dateTimeFormatter.format(m_CreateTime);
    }
  }

  public Timestamp getConcludeTime()
  {
    return m_ConcludeTime;
  }
  public void setConcludeTime(Timestamp tm)
  {
    m_ConcludeTime = tm;
  }
  public String getConcludeTimeString()
  {
    if ( m_ConcludeTime == null)
      return "";
    else
    {
      BoxStatic.dateTimeFormatter.applyPattern(BoxStatic.SHORT_DATE_FORMAT);
      return BoxStatic.dateTimeFormatter.format(m_ConcludeTime);
    }
  }

  public String toString()
  {
    String s = "id=" + m_iID
                + ", m_bMultiple=" + m_bMultiple
                + ", m_bShowVoter=" + m_bShowVoter
                + ", m_bShowResult=" + m_bShowResult
                + ", m_bManualConclude=" + m_bManualConclude
                + ", m_bClosed=" + m_bClosed
                + ", m_iSendResult=" + m_iSendResult
                + ", m_sSubject=" + m_sSubject
                + ", m_sDescription=" + m_sDescription
                + ", m_CreatedBy=" + m_CreatedBy
                + ", m_CreateTime=" + m_CreateTime
                + ", m_ConcludeTime=" + m_ConcludeTime
                + "\n";
    return s;
  }
}
